#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
    void moveZeroes(vector<int>& nums) {
        int slowIndex = 0;
        for(int fastIndex = 1;fastIndex < nums.size();++fastIndex){
            if(nums[slowIndex] == 0 && nums[fastIndex] != 0){
                swap(nums[slowIndex],nums[fastIndex]);
                slowIndex++;
            }else if(nums[slowIndex] != 0){
                slowIndex++;
            }
        }
    }
};

int main()
{
    Solution sol;
    vector<int> vec = {0,1,0,0,0,0,3,12};
    sol.moveZeroes(vec);
    for(auto item : vec)
        cout << item << " ";
    cout << endl;

    return 0;
}